//DDA支付
$(function(){
	canReturn();
	init();
	var appBases;
});

function init(){
	
	var sessAppBase = sessionStorage.getItem("appBase");
	var sendData = JSON.parse(sessAppBase);
	padMarketing.ajaxNormal('initPayment.action',sendData,
		function(result){
			var appBase = eval('(' + result.data + ')');
			console.log(appBase)
			$("#productName").text(appBase.productName);
			$("#phName").text(appBase.phName);
			$("#policyRef").text(appBase.policyRef);
			$("#nbPremium").text(formatMoney(appBase.nbPremium));
			//请求参数
			$("#piAccName").val(appBase.phName);
			$("#piAccountNo").val(appBase.mtBaNo);
			$("#piBankCategoryId").val(appBase.mtBaBankCategoryId);
			$("#piAreaCode").val(appBase.pmBaAreaCode);
			$("#piContractId").val(appBase.contractId);
			$("#piAmount").val(appBase.nbPremium);
			
		},
		function(){
			$('#alertMsg_btn3').click(function(){
				window.location.href = '/pad_marketing/ordermanager/index.action';
			});
			//alertMsg("支付初始化异常！");
		});
}

function submitPay(flag){
	var msg="根据保监规定，该保费不得使用信用卡支付。请确认您未使用信用卡支付上述保费，谢谢！";
	alertMsg(msg,1,toPay,flag);
}


/**
 * 支付完成按钮
 */
function payComplete(){
	//请求参数
	var appBases = {};
	appBases.partId = "";
	appBases.piAccName = $("#piAccName").val();
	appBases.piAccountNo = $("#piAccountNo").val();
	appBases.piBankCategoryId = $("#piBankCategoryId").val();
	appBases.piAreaCode = $("#piAreaCode").val();
	appBases.piContractId = $("#piContractId").val();
	appBases.piAmount = $("#piAmount").val();
	console.log(appBases)
	padMarketing.ajaxNormal('/pad_marketing/main/actualTimeDDA.action',appBases,
	function(data){
		console.log(data)
	},
	function(){
		
	});
}

function goBack(){
	
	var url = getArgsFromHref("url");
	if(url==''){
		history.go(-1);
	}else if(url.indexOf("/")>-1){
		window.location.href = "../"+url;
	}else{
		window.location = url;
	}
}

/**
 * 隐藏返回和上一步按钮
 */
function canReturn(){
	var url = getArgsFromHref("url");
	if(url==''){
		$("#return").hide();
//		$("#goback").hide();
	}
}

